import {
  pointList,
  pointDetail,
  pointEidt,
  pointCreate,
  pointDelete
} from '@/api/index';
export const rustapi = {
  pointDetail,
  pointList,
  pointEidt,
  pointCreate
};
export const queryParams = {
  inline: true,
  load: pointList,
  params: [
    {
      label: 'groupId',
      value: 'group_id'
    },
    {
      label: 'page',
      value: 'page'
    }
  ],
  items: [
    {
      eltype: 'button',
      visible: true,
      list: [
        {
          type: 'primary',
          visible: true,
          text: '新增',
          icon: 'plus',
          className: ''
        },
        {
          type: 'primary',
          visible: true,
          params: '*',
          text: '导入',
          icon: 'Download',
          className: ''
        },
        {
          type: 'primary',
          visible: true,
          params: '*',
          text: '导出',
          icon: 'Upload',
          className: ''
        }
      ]
    }
  ]
};

export const listParams = {
  items: [
    {
      label: '部件号',
      visible: true,
      name: 'partNumber'
    },
    {
      label: '数据类型',
      visible: true,
      name: 'data_type'
    },
    {
      label: '访问模式',
      visible: true,
      name: 'accessMode'
    },
    {
      label: '乘系数',
      visible: true,
      name: 'multiplier'
    },
    {
      label: '描述',
      visible: true,
      name: 'description'
    },

    {
      label: '操作',
      visible: true,
      eltype: 'button',
      list: [
        {
          text: '编辑',
          visible: true
        },
        {
          text: '删除',
          load: pointDelete,
          rreq: { label: 'id' },
          visible: true
        }
      ]
    }
  ]
};
export const dialogParams = {
  inline: false,
  datas: { device_id: '' },
  labelWidth: '120px',
  items: [
    {
      name: 'address',
      eltype: 'input',
      visible: true,
      maxlength: '20',
      required: true,
      label: '地址',
      placeholder: '请输入地址',
      className: ''
    },
    {
      name: 'dataType',
      eltype: 'input',
      visible: true,
      maxlength: '20',
      required: true,
      minlength: '1',
      label: '输入数据类型',
      placeholder: '请输入数据类型',
      className: ''
    },

    {
      name: 'accessMode',
      eltype: 'input',
      visible: true,
      maxlength: '20',
      required: true,
      minlength: '1',
      label: '访问模式',
      placeholder: '请输入访问模式',
      className: ''
    },

    {
      name: 'multiplier',
      eltype: 'input',
      visible: true,
      maxlength: '20',
      required: true,
      minlength: '1',
      label: '乘系数',
      placeholder: '请输入乘系数',
      className: ''
    },

    {
      name: 'precision',
      eltype: 'input',
      visible: true,
      maxlength: '20',
      required: true,
      minlength: '1',
      label: '偏移量',
      placeholder: '请输入偏移量',
      className: ''
    },

    {
      name: 'partNumber',
      eltype: 'input',
      visible: true,
      maxlength: '20',
      required: true,
      minlength: '1',
      label: '部件号',
      placeholder: '请输入部件号',
      className: ''
    },
    {
      name: 'description',
      eltype: 'input',
      visible: true,
      maxlength: '20',
      required: true,
      minlength: '1',
      label: '描述',
      placeholder: '请输入描述',
      className: ''
    },

    {
      eltype: 'button',
      visible: true,
      itemClassName: 'justify-center flex-row',
      list: [
        {
          type: 'primary',
          visible: true,
          plain: true,
          text: '取消',
          className: ''
        },
        {
          type: 'primary',
          visible: true,
          params: '*',
          loadType: 'or',
          nodekey: 'id',
          text: '保存',
          className: '',
          load: [
            {
              load: pointCreate,
              params: '*'
            },
            {
              load: pointEidt,
              params: '*',
              rreq: {
                label: 'id'
              }
            }
          ],
          rreq: {
            label: 'id'
          }
        }
      ]
    }
  ]
};
